package com.jic.member.impl;

import java.lang.Long;
import java.util.List;

import com.jic.common.base.vo.Page;
import com.jic.common.base.vo.PageResult;
import com.jic.member.entity.MememberRegisterConsume;
import com.jic.member.mapper.MememberRegisterConsumeMapper;
import com.jic.member.service.MememberRegisterConsumeService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 会员等级管理-注册赠送-消费抵现表
 * @author : 
 * @email : 
 * @since : 2020-04-02 07:54:47
 * @version : v1.0.0
 */
@Service
public class MememberRegisterConsumeServiceImpl implements MememberRegisterConsumeService{

    @Autowired
    private MememberRegisterConsumeMapper mememberRegisterConsumeMapper;

    @Override
    public long insert(MememberRegisterConsume mememberRegisterConsume) {
        long flag = mememberRegisterConsumeMapper.insert(mememberRegisterConsume);
        return flag;
    }

    @Override
    public long delete(Long id) {
        return mememberRegisterConsumeMapper.delete(id);
    }

    @Override
    public long update(MememberRegisterConsume mememberRegisterConsume) {
        return mememberRegisterConsumeMapper.update(mememberRegisterConsume);
    }

    @Override
    public MememberRegisterConsume queryByPrimaryKey(Long id){
        return mememberRegisterConsumeMapper.queryByPrimaryKey(id);
    }

    @Override
    public List<MememberRegisterConsume> query(MememberRegisterConsume mememberRegisterConsume){
        return mememberRegisterConsumeMapper.query(mememberRegisterConsume);
    }

    @Override
    public PageResult<MememberRegisterConsume> queryPage(MememberRegisterConsume mememberRegisterConsume, Page pageQuery) {
        //计算下标
        int startIndex = (pageQuery.getStart() - 1) * pageQuery.getLimit();
        List<MememberRegisterConsume> list = mememberRegisterConsumeMapper.queryPage(startIndex, pageQuery.getLimit(), mememberRegisterConsume);
        long count = mememberRegisterConsumeMapper.queryPageCount(mememberRegisterConsume);
        PageResult pageResult = new PageResult();
        pageResult.setRows(list);
        pageResult.setTotal(count);
        return pageResult;
    }
}